import axios from 'axios'

const http=axios.create({
    baseURL:'/api',
    timeout:10000,
    headers:{
        'Content-Type':'application/json'
    }
})
export const goodsAny = axios.create({
    baseURL: '',
    timeout: 1000,
    headers: {
        'Content-Type':'application/json'
    }
})
//axios请求前的拦截
http.interceptors.request.use(req=>{

    let token = sessionStorage.getItem('access_token');

    token && (req.headers['access_token']=token);

    return req;
},error=>{
    Promise.reject(error)
});
export default http
